<?php
declare (strict_types=1);

use think\facade\Route;

/**
 * 专项练习
 */
Route::group('admin/module/<module_id>/special', function () {
    // 专项练习配置
    Route::rule('config', 'config', 'GET|POST');
    // 新建专项
    Route::post('create', 'create');
    // 专项操作
    Route::group('<special_id>', function () {
        // 编辑专项
        Route::put('edit$', 'edit');
        // 编辑专项某个字段
        Route::put('edit/<field>', 'editField')->pattern(['field' => '[a-zA-Z_]+']);
        // 删除
        Route::delete('delete', 'delete');
    })->pattern(['special_id' => '\d+']);
})->prefix('\app\exam\service\admin\ModuleSpecial@')
    ->middleware('adminRoute')
    ->pattern(['module_id' => '\d+']);

/** 专项练习订单 */
Route::group('admin/special/order', function () {
    // 订单列表
    Route::get('$', 'orderList');
    // 订单导出
    Route::post('export', 'export');
})->prefix('\app\exam\service\admin\Order@')
    ->middleware('adminRoute')
    ->append(['product_key' => 'special']);